package com.qq.employee.dao;

import com.qq.employee.utity.Employee;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface EmployeeMapper {


    @Select("select * from employee_information where employeeId = #{employeeId}")
    Employee selectStaffByEmployeeId(int employeeId);
    @Select("select * from employee_information")
    List<Employee> listEmp();
    @Select("select * from employee_information where identificationCode = #{identificationCode}")
    List<Employee> selectStaffByIdentificationCode(int identificationCode);
//    @Insert("insert into employee_information where name = #{name},employeeId = #{employeeId},gender = #{gender},idNumber = #{idNumber},birthday = #{birthday},province = #{province},tel = #{tel},education = #{education},post = #{post},dept = #{dept},salary = #{salary}")

    @Insert("insert into employee_information (name,employeeId,gender,idNumber,birthday,province,tel,education,post,dept,salary,identificationCode) values(#{name},#{employeeId},#{gender},#{idNumber},#{birthday},#{province},#{tel},#{education},#{post},#{dept},#{salary},#{identificationCode})")
    int insertEmployee(Employee employee);
    @Update("update employee_information set name = #{name},employeeId = #{employeeId},gender = #{gender},idNumber = #{idNumber},birthday = #{birthday},province = #{province},tel = #{tel},education = #{education},post = #{post},dept = #{dept},salary = #{salary},identificationCode = #{identificationCode} where id = #{id}")
    int updateEmployee(Employee employee);
    @Delete("delete from employee_information where id=#{id}")
    int deleteEmployee(int id);
    @Select("select dept,identificationCode from employee_information")
    List<Employee> listDept();
    @Select("select *from employee_information where id=#{id}")
    Employee get(int id);



}
